package sortingRMI_server;

import java.rmi.Naming;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;


@SuppressWarnings("unused")
public class SortServer {
	
	private static final long serialVersionUID = -5174709117892447353L;
	private static SortServerWindow ssw;
	
	public static void openWindow() {
		ssw = new SortServerWindow();
		ssw.setVisible(true);
	}
	
	public static void main(String[] args) throws RemoteException {
		
		try {
			
			Registry registry = LocateRegistry.createRegistry(10001);
			
			Naming.rebind("rmi://127.0.0.1:10001/sf", new SortFactory());
				
				System.out.println("Bound SortFactory to the RMI service...\n");
				
				openWindow();
			
		} catch (Exception e) {
			System.out.println("Failed to bind a SortFactory to the RMI service..." + e);
			e.printStackTrace();
		}	
	}	
}